import type { Http } from '@/utils/http'

export default class SystemApi {

    protected request: Http

    constructor(request: Http) {
        this.request = request
    }

    querySysMenu<T>(args: { name?: string, mark?: string, parentId?: number }) {
        return this.request.get('manager/sysMenu', args)
    }

    queryMenuTree<T>(args: {}) {
        return this.request.get('manager/sysMenu/tree', args)
    }

    queryRoleMenu<T>(args: {}) {
        return this.request.get('manager/sysMenu/role', args)
    }

    queryUserMenu<T>(args: {}) {
        return this.request.get('manager/sysMenu/user', args)
    }

    insertSysMenu<T>(args: {}): Promise<any[]> {
        return this.request.postJson('manager/sysMenu/insert', args)
    }

    updateSysMenu<T>(args: {}): Promise<any[]> {
        return this.request.postJson('manager/sysMenu/update', args)
    }

    deleteSysMenu<T>(args: {}): Promise<any[]> {
        return this.request.postForm('manager/sysMenu/delete', args)
    }

    querySysRole<T>(args: {}): Promise<any[]> {
        return this.request.get('manager/sysRole', args)
    }

    insertSysRole<T>(args: {}): Promise<any[]> {
        return this.request.postJson('manager/sysRole/insert', args)
    }

    updateSysRole<T>(args: {}): Promise<any[]> {
        return this.request.postJson('manager/sysRole/update', args)
    }

    deleteSysRole<T>(args: {}): Promise<any[]> {
        return this.request.postForm('manager/sysRole/delete', args)
    }

}

